<p-dialog header="{{title}}" [(visible)]="display" modal="modal" width="610" [responsive]="true" (onHide)="closeConEditMask(false)">
  <p-messages [(value)]="applymsgs"></p-messages>
  <div class="ui-grid ui-grid-responsive ui-grid-pad ui-fluid" style="margin: 10px 0px">
    <form [formGroup]="config">

      <div class="ui-grid-row margin-bottom-1vw">
        <div class="ui-grid-col-2"></div>
        <div class="ui-grid-col-8 addr">
          <label for="">
            <span class="red_start">*</span>
            报表模板：
          </label>
          <p-autoComplete formControlName="names" name="names" [suggestions]="templates" field="text" [(ngModel)]="names" (completeMethod)="searchTemps($event)" (onSelect)="selectTemp($event)" [dropdown]="true" [multiple]="true" [style.width.%]="70">
            <!--<ng-template let-value pTemplate="selectedItem">
              <span style="font-size:18px">>{{value}}<</span>
            </ng-template>-->
            <ng-template let-brand pTemplate="item">
              <div class="ui-helper-clearfix" style="border-bottom:1px solid #D5D5D5">
                <div style="font-size:18px;float:right;margin:10px 10px 0 0">{{brand.text}}</div>
              </div>
            </ng-template>
          </p-autoComplete>
          <!--{{text}}-->
        </div>
      </div>

      <div class="ui-grid-row margin-bottom-1vw">
        <div class="ui-grid-col-2"></div>
        <div class="ui-grid-col-8 addr">
          <label for="">
            <span class="red_start">*</span>
            发送时间：
          </label>
          <p-calendar [showIcon]="true" dateFormat="yy-mm-dd" *ngIf="dayShow" [style.width.%]="70" ngClass="birthday" [(ngModel)]="dayTime" formControlName="dayTime" dataType="string" [timeOnly]="true" [locale]="ch"></p-calendar>

          <p-calendar [showIcon]="true" dateFormat="dd" *ngIf="monthShow" [style.width.%]="70" ngClass="birthday" [(ngModel)]="monthTime" formControlName="monthTime" dataType="string" [monthNavigator]="true" [showTime]="true" [locale]="ch"></p-calendar>

          <p-calendar [showIcon]="true" dateFormat="mm-dd" *ngIf="yearShow" [style.width.%]="70" ngClass="birthday" [(ngModel)]="yearTime" formControlName="yearTime" dataType="string" [monthNavigator]="true" [showTime]="true" [locale]="ch"></p-calendar>

          <p-dropdown [options]="weeks" [(ngModel)]="week" formControlName="week" [style]="{'width':'79px'}" *ngIf="weekShow"></p-dropdown>
          <p-calendar [showIcon]="true" dateFormat="yy-mm-dd" *ngIf="weekShow" [style.width.%]="45" [style.marginLeft.px]="16" ngClass="birthday" [(ngModel)]="weekTime" formControlName="weekTime" dataType="string" [timeOnly]="true" [locale]="ch"></p-calendar>
        </div>
      </div>

      <div class="ui-grid-row margin-bottom-1vw">
        <div class="ui-grid-col-2"></div>
        <div class="ui-grid-col-8 addr">
          <label for="">
            <span class="red_start">*</span>
            发送方式：
          </label>
          <p-radioButton formControlName="send_way" name="send_way" value="email" label="邮件" [style.width.%]="35" [(ngModel)]="sendWay"></p-radioButton>
          <p-radioButton formControlName="send_way" name="send_way" value="other" label="其他" [style.width.%]="35" [(ngModel)]="sendWay"></p-radioButton>
        </div>
      </div>

      <div class="ui-grid-row margin-bottom-1vw">
        <div class="ui-grid-col-2"></div>
        <div class="ui-grid-col-8 addr">
          <label for="">
            <span class="red_start">*</span>
            接收人：
          </label>
          <p-autoComplete formControlName="receivers" name="receivers" [(ngModel)]="receivers" [suggestions]="persons" field="text" (completeMethod)="searchPersons($event)" [dropdown]="true" [multiple]="true"  [style.width.%]="70">
            <ng-template let-brand pTemplate="item">
              <div class="ui-helper-clearfix" style="border-bottom:1px solid #D5D5D5">
                <div style="font-size:18px;float:right;margin:10px 10px 0 0">{{brand.text}}</div>
              </div>
            </ng-template>
          </p-autoComplete>
        </div>
      </div>

      <div class="ui-grid-row margin-bottom-1vw">
        <div class="ui-grid-col-2"></div>
        <div class="ui-grid-col-8 addr">
          <label for="">
            <span class="red_start">*</span>
            是否启用：
          </label>
          <p-checkbox value="true" formControlName="enable" [(ngModel)]="enable" label="启用" [style.width.%]="70"></p-checkbox>
        </div>
      </div>


    </form>
  </div>
  <p-footer>
    <button type="button" pButton icon="fa-check" (click)="formSubmit()" [disabled]="!config.controls['names'].valid || !config.controls['receivers'].valid" label="保存"></button>
    <button type="button" pButton icon="fa-close" (click)="display=false" label="取消" class="ui-button-secondary"></button>
  </p-footer>
</p-dialog>
